<p>This rule raises an issue when an Angular lifecycle method is declared but has an empty body with no implementation.</p>
<h2>Why is this an issue?</h2>
<p>Empty lifecycle methods in Angular components, directives, and services serve no purpose and create unnecessary code clutter. These methods are
typically created when implementing lifecycle interfaces like <code>OnInit</code>, <code>OnDestroy</code>, or <code>AfterViewInit</code>, but then
left without any implementation.</p>
<p>Empty lifecycle methods can:</p>
<ul>
  <li> Make the codebase harder to read and maintain </li>
  <li> Suggest incomplete or forgotten implementation </li>
  <li> Add unnecessary overhead during Angular’s change detection cycle </li>
  <li> Confuse other developers about the intended functionality </li>
</ul>
<p>Angular will call these methods during the component lifecycle even when they’re empty, which means they consume processing time without providing
any value.</p>
<h3>What is the potential impact?</h3>
<p>While empty lifecycle methods don’t cause runtime errors, they negatively impact code maintainability and can slightly affect performance due to
unnecessary method calls during Angular’s lifecycle execution.</p>
<h3>How to fix in Angular?</h3>
<p>Remove the empty lifecycle method entirely. If you don’t need to implement the lifecycle hook, simply don’t declare the method.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
@Component()
class MyComponent implements OnInit {
  ngOnInit() {} // Noncompliant
}
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
@Component()
class MyComponent {
  // No ngOnInit method needed if there's no implementation
}
</pre>
<p>If you plan to implement the method later, add a TODO comment or implement the actual logic immediately.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="2" data-diff-type="noncompliant">
@Component()
class MyComponent implements OnDestroy {
  ngOnDestroy() {} // Noncompliant
}
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="2" data-diff-type="compliant">
@Component()
class MyComponent implements OnDestroy {
  ngOnDestroy() {
    // Clean up subscriptions
    this.subscription.unsubscribe();
  }
}
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/angular-eslint/angular-eslint">Angular ESLint</a> - Rule <a
  href="https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-empty-lifecycle-method.md">no-empty-lifecycle-method</a> </li>
  <li> Angular Lifecycle Hooks - <a href="https://angular.dev/guide/components/lifecycle">Official Angular documentation on lifecycle hooks and their
  usage</a> </li>
  <li> Angular Component Lifecycle - <a href="https://angular.dev/guide/components">Guide to Angular components and their lifecycle methods</a> </li>
</ul>
